classmates = ["jack","jony","zhangsan"]
print(classmates)

print(len(classmates)) # 长度
print(classmates[0]) # 访问第一个

print(classmates[-1]) #访问最后一个

classmates.append("appended-001")

print(classmates[-1]) #访问最后一个

classmates.append(True) #可以类型不同
print(classmates[-1]) #访问最后一个

classmates.append([12,True,False]) # 添加子list
print(classmates[-1][0]) # 12


#--------------------------------------------------------------------------
# tuple
colleague = ("zhangsan","lisi",True)
print(colleague[0])
print(colleague[-1])
print(len(colleague))
tuple1 = (1) # 这里相当于定义了一个整数。必须加上逗号才是tuple
print(tuple1)


# 定义只有一个元素的tuple
tuple2 = ("str",)
print(tuple2)
print(tuple2[0])
# tuple2[0] = 1
tuple2 = ("hello world")
print(tuple2)
print(len(tuple2))




#"可变"的tuple
tuple3 = (1,3,"string",[111,222])
print(tuple3)
tuple3[3][0] = 444
print(tuple3)


# Practice
L = [
    ['Apple', 'Google', 'Microsoft'],
    ['Java', 'Python', 'Ruby', 'PHP'],
    ['Adam', 'Bart', 'Bob']
]

print(L[0][0])
print(L[1][1])
print(L[2][-1])